package com.o2o.util;

public class HBaseUtil {
	public static String getStopRowKey(String startRowKey){
		int i=startRowKey.length()-1;//
		String finalS = "";
		while(i>=0){
			char tmp = startRowKey.charAt(i);
			char c1 = '0';
			if(c1 !=tmp){
				String afterNumber = startRowKey.substring(0, i+1);
				int num = Integer.parseInt(afterNumber);
				finalS = (num+1)+""+startRowKey.substring(i+1, startRowKey.length());
				break;
			}
			i--;
		}
		return finalS;
	}
	/**
	 * 数字转字符串前面自动补0，若number位数小于给定的length，则不做处理原样返回
	 * @param length 字符串处理后的总长度
	 * @param number 要处理的数字
	 * @return String
	 */
	public static String numberChange(int length,long number){
		if((number+"").length() > length){
			return number+"";
		}else{
			String str = String.format("%0"+length+"d", number);//d 代表参数为正数型,4 代表长度为4,0 代表前面补充0
			return str;
		}
	}
	

}
